<?php
require_once('model/Category.php');

class Category extends DataObjects_Category 
{
	
	/**
	 * Get all category
	 *
	 * @return Category object
	 */
	public function getList($filter = array(), $pagination = true){
		
		$category = new Category();
		if(isset($filter['category_name']) && $filter['category_name']){
			$category->whereAdd('name LIKE "%'.$filter['category_name'].'%"');
		}
		
		if($pagination){
			$p = new FRM_Pager('page',Parameter::$params["PAGING_DEFAULT_ITEM_PER_PAGE"], new FRM_Pager_RangeIterator(1, Parameter::$params['PAGING_DEFAULT_PAGE_DELTA'], 1));
			$category->setPager($p);
		}
		$category->orderBy('id');
		$category->find();
		//echo $category->getSelectSQL(); die;
		return $category;
	}

}
?>